package com.aiwhose.aiwhosecore.bean.system.table;

import com.mybatisflex.core.query.QueryColumn;
import com.mybatisflex.core.table.TableDef;

import java.io.Serial;

/**
 * 轮播图 表定义层。
 *
 * @author 田国刚
 * @since 1.0.1
 */
public class BannerTableDef extends TableDef {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 轮播图
     */
    public static final BannerTableDef BANNER = new BannerTableDef();

    
    public final QueryColumn ID = new QueryColumn(this, "id");

    /**
     * 横幅名称
     */
    public final QueryColumn NAME = new QueryColumn(this, "name");

    /**
     * banner类型
     */
    public final QueryColumn TYPE = new QueryColumn(this, "type");

    /**
     * 状态 (0: 禁用, 1: 启用)
     */
    public final QueryColumn STATUS = new QueryColumn(this, "status");

    /**
     * 显示失败时的文字内容
     */
    public final QueryColumn ALT_TEXT = new QueryColumn(this, "alt_text");

    /**
     * 删除标识，0 表示未删除，1 表示已删除
     */
    public final QueryColumn DELETED = new QueryColumn(this, "deleted");

    /**
     * 结束时间
     */
    public final QueryColumn END_TIME = new QueryColumn(this, "end_time");

    /**
     * 跳转地址
     */
    public final QueryColumn JUMP_URL = new QueryColumn(this, "jump_url");

    /**
     * 创建者
     */
    public final QueryColumn CREATE_BY = new QueryColumn(this, "create_by");

    /**
     * 顺序
     */
    public final QueryColumn SEQUENCE = new QueryColumn(this, "sequence");

    /**
     * 更新人
     */
    public final QueryColumn UPDATE_BY = new QueryColumn(this, "update_by");

    /**
     * banner地址
     */
    public final QueryColumn BANNER_URL = new QueryColumn(this, "banner_url");

    /**
     * 开始时间
     */
    public final QueryColumn START_TIME = new QueryColumn(this, "start_time");

    /**
     * 点击次数
     */
    public final QueryColumn CLICK_COUNT = new QueryColumn(this, "click_count");

    /**
     * 创建时间
     */
    public final QueryColumn CREATE_TIME = new QueryColumn(this, "create_time");

    /**
     * 更新时间
     */
    public final QueryColumn UPDATE_TIME = new QueryColumn(this, "update_time");

    /**
     * 描述
     */
    public final QueryColumn DESCRIPTION = new QueryColumn(this, "description");

    /**
     * 所有字段。
     */
    public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");

    /**
     * 默认字段，不包含逻辑删除或者 large 等字段。
     */
    public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, BANNER_URL, NAME, TYPE, JUMP_URL, SEQUENCE, ALT_TEXT, START_TIME, END_TIME, STATUS, CLICK_COUNT, DESCRIPTION, CREATE_BY, UPDATE_BY, CREATE_TIME, UPDATE_TIME};

    public BannerTableDef() {
        super("", "banner");
    }

    private BannerTableDef(String schema, String name, String alisa) {
        super(schema, name, alisa);
    }

    public BannerTableDef as(String alias) {
        String key = getNameWithSchema() + "." + alias;
        return getCache(key, k -> new BannerTableDef("", "banner", alias));
    }

}
